<?php

//Crypt encode the password

function check_date($date, $mktime=FALSE, $delimiter='-')
{
	try {
		$date = explode($delimiter, $date);
		$count = 0;
		foreach ($date as $value)
		{
			if (preg_match('/^\d*$/', $value))
			{
				$count++;
			}
			else
			{
				return FALSE;
			}
		}
		if (3 == $count)
		{
			if (checkdate($date[1], $date[2], $date[0]))
			{
				if ($mktime)
				{
					return mktime(0, 0, 0, $date[1], $date[2], $date[0]);
				}
				else
				{
					return TRUE;
				}
			}
		}
		else
		{
			return FALSE;
		}
		return TRUE;
	} catch (Exception $e) {
		return FALSE;
	}
}